package cn.hchaojie.camp.day12;

public class DemoJoin {
	public static void main(String[] args) {
		Thread t = new Thread(new JoinRunnable());
		t.start();
		
		try {
			t.join();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		
		System.out.println("主线程结束。。。");
		System.exit(0);
	}
}

class JoinRunnable implements Runnable {
	private int count = 10;
	@Override
	public void run() {
		try {
			while (count > 0) {
				Thread.sleep(500);
				System.out.println(count--);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
